import delivery1 from './delivery1Mock';
import delivery2 from './delivery2Mock';
import login from './loginMock';
import mock6400 from './mock6400';

export default {
    ...delivery1,
    ...delivery2,
    ...login,

    /**
     * demo mock
     * @param req
     * @param res
     * @returns {*}
     * @constructor
     */
    'GET /api/list': function (req, res) {
        let query = req.query || {};
        return res.json({
            limit: query.limit,
            offset: query.offset,
            list: [{
                username: 'admin1',
                sex: 1,
            }, {
                username: 'admin2',
                sex: 0,
            }]
        })
    },
    'GET /api/userinfo/:id': (req, res) => {
        return res.json({
            id: req.params.id,
            username: 'kenny',
        });
    },
    'POST /api/login/account': (req, res) => {
        const {password, username} = req.body;
        if (password === '888888' && username === 'admin') {
            return res.json({
                status: 'ok',
                token: 'sdfsdfsdfdsf',
            });
        } else {
            return res.json({
                status: 'error',
                code: 403,
            });
        }
    },
    'DELETE /api/user/:id': (req, res) => {
        // console.log(req.params.id);
        res.send({status: 'ok', message: 'delete success!'});
    },
    'PUT /api/user/:id': (req, res) => {
        // console.log(req.params.id);
        // console.log(req.body);
        res.send({status: 'ok', message: 'update success！'});
    },
}
